import { useState } from "react"
export default function Hook() {
    let [n, setA] = useState(0)
    let [arr, setArr] = useState([1, 2, 3, 4, 5, 6])
    let [obj, setObj] = useState({uname:'张三'})
    function clk() {
        n++;
        setA(n)
        setArr([...arr,4])
        obj.uname='李四'
        setObj({...obj})
    }
    return <div>
        <div>a:{n}</div>
        <button onClick={clk}>++</button>
        <ul>
            {
                arr.map((i, ind) => {
                   return <li key={ind}>{i}</li>
                })
            }
            <p>{obj.uname}</p>

        </ul>
    </div>
}